package com.hnucm.c201901020121;

import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.hyphenate.EMCallBack;
import com.hyphenate.chat.EMClient;
import com.hyphenate.easeui.ui.base.EaseBaseFragment;

public class ChatAct extends AppCompatActivity {
    public static ChatAct act;
    private EaseBaseFragment easeBaseFragment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat);
        act=this;
        easeBaseFragment=new EaseBaseFragment();
        easeBaseFragment.setArguments(getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.chat_frg,easeBaseFragment).commit();
        EMClient.getInstance().login("123456", "asd123456", new EMCallBack() {
            @Override
            public void onSuccess() {
                Toast.makeText(ChatAct.this,"登陆成功",Toast.LENGTH_LONG).show();
                EMClient.getInstance().chatManager().loadAllConversations();
            }

            @Override
            public void onError(int code, String error) {

            }

            @Override
            public void onProgress(int progress, String status) {

            }
        });

    }

}